package com.ruoyi.web.controller.solidDispose;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.solidDispose.domain.WxfwjcrktzInfo;
import com.ruoyi.solidDispose.service.IWxfwjcrktzInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 危险废物接收企业入库台帐Controller
 * 
 * @author ruoyi
 * @date 2021-09-02
 */
@RestController
@RequestMapping("/solidDispose/wxfwjcrktzInfo")
public class WxfwjcrktzInfoController extends BaseController
{
    @Autowired
    private IWxfwjcrktzInfoService wxfwjcrktzInfoService;

    /**
     * 查询危险废物接收企业入库台帐列表
     */
    @PreAuthorize("@ss.hasPermi('solidDispose:wxfwjcrktzInfo:list')")
    @GetMapping("/list")
    public TableDataInfo list(WxfwjcrktzInfo wxfwjcrktzInfo)
    {
        startPage();
        List<WxfwjcrktzInfo> list = wxfwjcrktzInfoService.selectWxfwjcrktzInfoList(wxfwjcrktzInfo);
        return getDataTable(list);
    }

    /**
     * 导出危险废物接收企业入库台帐列表
     */
    @PreAuthorize("@ss.hasPermi('solidDispose:wxfwjcrktzInfo:export')")
    @Log(title = "危险废物接收企业入库台帐", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(WxfwjcrktzInfo wxfwjcrktzInfo)
    {
        List<WxfwjcrktzInfo> list = wxfwjcrktzInfoService.selectWxfwjcrktzInfoList(wxfwjcrktzInfo);
        ExcelUtil<WxfwjcrktzInfo> util = new ExcelUtil<WxfwjcrktzInfo>(WxfwjcrktzInfo.class);
        return util.exportExcel(list, "危险废物接收企业入库台帐数据");
    }

    /**
     * 获取危险废物接收企业入库台帐详细信息
     */
    @PreAuthorize("@ss.hasPermi('solidDispose:wxfwjcrktzInfo:query')")
    @GetMapping(value = "/{wxfwjcrktzId}")
    public AjaxResult getInfo(@PathVariable("wxfwjcrktzId") Long wxfwjcrktzId)
    {
        return AjaxResult.success(wxfwjcrktzInfoService.selectWxfwjcrktzInfoById(wxfwjcrktzId));
    }

    /**
     * 新增危险废物接收企业入库台帐
     */
    @PreAuthorize("@ss.hasPermi('solidDispose:wxfwjcrktzInfo:add')")
    @Log(title = "危险废物接收企业入库台帐", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody WxfwjcrktzInfo wxfwjcrktzInfo)
    {
        return toAjax(wxfwjcrktzInfoService.insertWxfwjcrktzInfo(wxfwjcrktzInfo));
    }

    /**
     * 修改危险废物接收企业入库台帐
     */
    @PreAuthorize("@ss.hasPermi('solidDispose:wxfwjcrktzInfo:edit')")
    @Log(title = "危险废物接收企业入库台帐", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody WxfwjcrktzInfo wxfwjcrktzInfo)
    {
        return toAjax(wxfwjcrktzInfoService.updateWxfwjcrktzInfo(wxfwjcrktzInfo));
    }

    /**
     * 删除危险废物接收企业入库台帐
     */
    @PreAuthorize("@ss.hasPermi('solidDispose:wxfwjcrktzInfo:remove')")
    @Log(title = "危险废物接收企业入库台帐", businessType = BusinessType.DELETE)
	@DeleteMapping("/{wxfwjcrktzIds}")
    public AjaxResult remove(@PathVariable Long[] wxfwjcrktzIds)
    {
        return toAjax(wxfwjcrktzInfoService.deleteWxfwjcrktzInfoByIds(wxfwjcrktzIds));
    }
}
